/*
 *
 *  name: baseMotheds
 *  author: tonney
 *  date: 2019/04/17 10:30
 *
 */
$(function() {
    baseMotheds.init();
});

function checkSearch(){
    var searchInput = $('#searchInput').val();
    var searchVal = $.trim(searchInput);
    if(searchVal == ''){
		layer.msg("哎呀，你好像忘记输入搜索内容了！");
		return false;
    }
    if(searchVal.length < 2){
		layer.msg("搜索关键字至少需要2个字哟！");
		return false;
    }
	return true;
};

// baseMotheds
var baseMotheds = function() {
    var scrollTop = function() {
        var offset = 300,
            offset_opacity = 1200,
            scroll_top_duration = 700,
            scrollstrx = window.decodeURIComponent(window.atob("RGVzaWduIGJ5IHd3dy5kdW9ndXl1LmNvbQ==")),
            $back_to_top = $('.backTop');
        $(window).scroll(function() {
            ($(this).scrollTop() > offset) ? $back_to_top.addClass('backTopVisible'): $back_to_top.removeClass('backTopVisible cd-fade-out');
            if ($(this).scrollTop() > offset_opacity) {
                $back_to_top.addClass('cd-fade-out');
            }
        });
        $back_to_top.on('click', function(event) {
            event.preventDefault();
            var _0x47d1=['color:#3873FF'];var _0x2a1e=function(_0x47d1d1,_0x2a1e43){_0x47d1d1=_0x47d1d1-0x0;var _0x4d7de5=_0x47d1[_0x47d1d1];return _0x4d7de5;};console['log']('%c'+scrollstrx,_0x2a1e('0x0'));
            $('body,html').animate({scrollTop: 0}, scroll_top_duration);
        });
    };
    return {
        init: function() {
            scrollTop();
        }
    }
}();